<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <Script Language ="JavaScript">
        function submitClick(){
        //  访问第一个表单内name=UserId的元素的值，将值赋给变量Userid  forms[0]也可以用name属性InputForm来代替
         var Userid = document.forms[0].UserId.value;
         if(Userid==""){alert("用户名称不能为空");return false;}
         var UserPwd = document.forms[0].UserPwd.value;
         if(UserPwd==""){alert("用户密码不能为空");return false;}
         var reUserPwd = document.forms[0].reUserPwd.value;
         if(reUserPwd==""){alert("请重复密码输入");return false;}
         if (UserPwd!=reUserPwd){
         alert("两次输入密码不一致！请重新输入");
         document.forms[0].UserPwd.value ="";
         document.forms[0].reUserPwd.value ="";
         document.forms[0].UserPwd.focus();
         return false;
         }
         var strMsg ="";
         strMsg = "你的用户名称为：" + Userid + "; 你的密码为：" + reUserPwd +";";
         document.forms[0].DispInfo.value = strMsg
         alert(strMsg);
        }
        function ResetClick(){
         document.forms[0].reset();
        }
        function CallSubmitClick(){
         document.forms[0].Submit.click();
        }
    </Script>
</head>
<body>
    <!-- action属性的值，为某个页面的地址。当表单提交后，表单内容将发送给action所指定的页面 -->
    <form name="InputForm" method="post" action="">
        <br>请输入用户名称：<input type="text" name="UserId" id="UserIdid">
        <br>请输入用户密码：<input type="password" name="UserPwd">
        <br>请重复用户密码：<input type="password" name="reUserPwd">
        <br>
        <br>用户输入信息的反馈： <input type="text" name="DispInfo" size="60" readonly>
        <br>
         <input type="button" name="BtnSubmit" value="提交" onclick=javascript:submitClick()>
         <input type="button" name="BtnReset" value="重写" onclick=javascript:ResetClick()>
         <!-- <input type="Reset" name="Reset" value="重写"> -->
        <br>
         <input type="button" name="BtnCallSubmit" value="调用提交按钮" onclick=CallSubmitClick()>
    </form>
</body>
</html>